package cz.kfad.ofrss.util;

import java.util.ArrayList;
import java.util.List;

import cz.kfad.ofrss.model.Category;
import cz.kfad.ofrss.model.Channel;
import cz.kfad.ofrss.model.RssFeedShort;

public class CollectionsUtil {


    public static List<String> toCategoryNames(List<Category> allCategories) {
        final ArrayList<String> strings = new ArrayList<String>();
        for (Category category : allCategories) {
            strings.add(category.getName());
        }
        return strings;
    }

    public static List<String> toChannelsNames(List<Channel> allChannels) {
        final ArrayList<String> strings = new ArrayList<String>();
        for (Channel channel : allChannels) {
            strings.add(channel.getName());
        }
        return strings;
    }

	public static int[] createFeedIdsArray(List<RssFeedShort> feeds) {
		final int feedsCount = feeds.size();
		final int[] ints = new int[feedsCount];
		for (int i = 0; i < feedsCount; i++) {
			ints[i] = feeds.get(i).getId();
		}
		return ints;
	}
}
